home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.5 KB | 198 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPicShp.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWPICSHP_H
- #include "FWPicShp.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef SLGRGLOB_H
- #include "SLGrGlob.h"
- #endif
-
- #ifndef FWBMPSHP_H
- #include "FWBmpShp.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef SLRENDER_H
- #include "SLRender.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- #ifndef FWDEBUG_H
- #include "FWDebug.h"
- #endif
-
- #ifndef FWMEMORY_H
- #include "FWMemory.h"
- #endif
-
- //========================================================================================
- // File scope definitions
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphics_PictureShape
- #endif
-
- //========================================================================================
- // class FW_CPictureShape
- //========================================================================================
-
- FW_DEFINE_AUTO(FW_CPictureShape)
- FW_DEFINE_CLASS_M1(FW_CPictureShape, FW_CBoundedShape)
-
- // This class is archivable, but we provide the archiving implementation in a separate
- // translation unit in order to enable deadstripping of the archiving-related code
- // in parts that do not use archiving with this class.
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::FW_CPictureShape
- //----------------------------------------------------------------------------------------
-
- FW_CPictureShape::FW_CPictureShape(FW_CPicture picture, const FW_CRect& rect) :
- FW_CBoundedShape(rect, FW_kFill, FW_kNormalInk, FW_kNormalStyle, FW_kNormalFont),
- fPicture(picture)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::FW_CPictureShape
- //----------------------------------------------------------------------------------------
-
- FW_CPictureShape::FW_CPictureShape(const FW_CPictureShape& other) :
- FW_CBoundedShape(other),
- fPicture(other.fPicture)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::FW_CPictureShape
- //----------------------------------------------------------------------------------------
-
- FW_CPictureShape::FW_CPictureShape(FW_CReadableStream& stream) :
- FW_CBoundedShape(stream),
- fPicture()
- {
- stream >> fPicture;
-
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::~FW_CPictureShape
- //----------------------------------------------------------------------------------------
-
- FW_CPictureShape::~FW_CPictureShape()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::operator=
- //----------------------------------------------------------------------------------------
-
- FW_CPictureShape& FW_CPictureShape::operator=(const FW_CPictureShape& other)
- {
- if (this != &other)
- {
- FW_CBoundedShape::operator=(other);
-
- fPicture = other.fPicture;
- }
-
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::Render
- //----------------------------------------------------------------------------------------
-
- void FW_CPictureShape::Render(FW_CGraphicContext& gc) const
- {
- FW_PrivRenderPicture(gc.GetEnvironment(),
- gc,
- fPicture,
- fRect,
- GetRenderVerb());
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::RenderPicture
- //----------------------------------------------------------------------------------------
-
- void FW_CPictureShape::RenderPicture(FW_CGraphicContext& gc,
- FW_CPicture picture,
- const FW_CRect& dstRect)
- {
- FW_PrivRenderPicture(gc.GetEnvironment(),
- gc,
- picture,
- dstRect,
- FW_kFill);
- FW_FailOnEvError(gc.GetEnvironment());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::GetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CPictureShape::GetGeometry(FW_CPicture& picture, FW_CRect& dstRect) const
- {
- picture = fPicture;
- dstRect = fRect;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::SetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CPictureShape::SetGeometry(const FW_CPicture& picture, const FW_CRect& dstRect)
- {
- fPicture = picture;
- fRect = dstRect;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::Flatten
- //----------------------------------------------------------------------------------------
-
- void FW_CPictureShape::Flatten(FW_CWritableStream& stream) const
- {
- FW_CBoundedShape::Flatten(stream);
- stream << fPicture;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPictureShape::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CShape* FW_CPictureShape::Copy() const
- {
- return FW_NEW(FW_CPictureShape, (*this));
- }
-
-